package com.example.tiptravel.presenter.home;

import com.example.tiptravel.entity.home.Banner;
import com.example.tiptravel.model.ModelFactory;
import com.example.tiptravel.view.impl.home.BannerView;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by 45820 on 2016/11/9.
 */

public class BannerPresenter {

    private BannerView bannerView;

    public BannerPresenter(BannerView bannerView) {
        this.bannerView = bannerView;
    }

    public void getBannerData(Map<String,String> map){
        ModelFactory.getiHomeModel().getBannerData(map, new Subscriber<Banner>() {
            @Override
            public void onCompleted() {
                bannerView.onComplete();
            }

            @Override
            public void onError(Throwable e) {
                bannerView.onFailure(e);
            }

            @Override
            public void onNext(Banner banner) {
                bannerView.onSuccess(banner);
            }
        });
    }
}
